package com.example.agent_springai.entity.query;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.example.agent_springai.util.CustomLocalDateTimeDeserializer;
import lombok.Data;
import org.springframework.ai.tool.annotation.ToolParam;

import java.time.LocalDateTime;
import java.util.List;

@Data
public class ChainlooseQuery {

    @ToolParam(description = "时间戳，用于解决同一时间多组数据问题")
    private String timestamp;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonDeserialize(using = CustomLocalDateTimeDeserializer.class)
    @ToolParam(required = false, description = "查询开始时间，格式为 yyyy-MM-dd HH:mm:ss。" +
            "J3传动链松动，运动轨迹LDF，负载0.默认为2024-11-13 16:12:00。" +
            "J3传动链松动，运动轨迹LDF，负载7.默认为2024-11-13 12:20:00。" +
            "J3正常，运动轨迹LDF，负载0.默认为2024-11-12 18:31:19。" +
            "时间如果用户说最近，则固定结束数据即默认值，开始时间根据用户提示词往前推\n" +
            "如果用户说类似前20s这种，则固定开始时间即默认值，结束时间根据用户提示词往后推")
    private LocalDateTime startTime = LocalDateTime.of(2024, 11, 13, 16, 12, 0);

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonDeserialize(using = CustomLocalDateTimeDeserializer.class)
    @ToolParam(required = false, description = "查询结束时间，格式为 yyyy-MM-dd HH:mm:ss。" +
            "J3传动链松动，运动轨迹LDF，负载0.默认为2024-11-13 16:59:38。" +
            "J3传动链松动，运动轨迹LDF，负载7.默认为2024-11-13 13:10:53。" +
            "J3正常，运动轨迹LDF，负载0.默认为2024-11-12 19:10:00。" +
            "时间如果用户说最近，则固定结束数据即默认值，开始时间根据用户提示词往前推\n" +
            "如果用户说类似前20s这种，则固定开始时间即默认值，结束时间根据用户提示词往后推")
    private LocalDateTime endTime = LocalDateTime.of(2024, 11, 13, 16, 59, 38);

    /**
     * axis0相关电压、电流、位置参数
     */
    @ToolParam(required = false, description = "是否需要查询axis0轴0电压指令值")
    private Boolean needAxis0Vcmd = false;
    
    @ToolParam(required = false, description = "是否需要查询axis0轴0电压反馈值")
    private Boolean needAxis0Vfb = false;
    
    @ToolParam(required = false, description = "是否需要查询axis0轴0电流指令值")
    private Boolean needAxis0Acmd = false;
    
    @ToolParam(required = false, description = "是否需要查询axis0轴0电流反馈值")
    private Boolean needAxis0Afb = false;
    
    @ToolParam(required = false, description = "是否需要查询axis0轴0位置指令值")
    private Boolean needAxis0Ecmd = false;
    
    @ToolParam(required = false, description = "是否需要查询axis0轴0位置反馈值")
    private Boolean needAxis0Efb = false;

    /**
     * axis1相关电压、电流、位置参数
     */
    @ToolParam(required = false, description = "是否需要查询axis1轴1电压指令值")
    private Boolean needAxis1Vcmd = false;
    
    @ToolParam(required = false, description = "是否需要查询axis1轴1电压反馈值")
    private Boolean needAxis1Vfb = false;
    
    @ToolParam(required = false, description = "是否需要查询axis1轴1电流指令值")
    private Boolean needAxis1Acmd = false;
    
    @ToolParam(required = false, description = "是否需要查询axis1轴1电流反馈值")
    private Boolean needAxis1Afb = false;
    
    @ToolParam(required = false, description = "是否需要查询axis1轴1位置指令值")
    private Boolean needAxis1Ecmd = false;
    
    @ToolParam(required = false, description = "是否需要查询axis1轴1位置反馈值")
    private Boolean needAxis1Efb = false;

    /**
     * axis2相关电压、电流、位置参数
     */
    @ToolParam(required = false, description = "是否需要查询axis2轴2电压指令值")
    private Boolean needAxis2Vcmd = false;
    
    @ToolParam(required = false, description = "是否需要查询axis2轴2电压反馈值")
    private Boolean needAxis2Vfb = false;
    
    @ToolParam(required = false, description = "是否需要查询axis2轴2电流指令值")
    private Boolean needAxis2Acmd = false;
    
    @ToolParam(required = false, description = "是否需要查询axis2轴2电流反馈值")
    private Boolean needAxis2Afb = false;
    
    @ToolParam(required = false, description = "是否需要查询axis2轴2位置指令值")
    private Boolean needAxis2Ecmd = false;
    
    @ToolParam(required = false, description = "是否需要查询axis2轴2位置反馈值")
    private Boolean needAxis2Efb = false;

    /**
     * axis3相关电压、电流、位置参数
     */
    @ToolParam(required = false, description = "是否需要查询axis3轴3电压指令值")
    private Boolean needAxis3Vcmd = false;
    
    @ToolParam(required = false, description = "是否需要查询axis3轴3电压反馈值")
    private Boolean needAxis3Vfb = false;
    
    @ToolParam(required = false, description = "是否需要查询axis3轴3电流指令值")
    private Boolean needAxis3Acmd = false;
    
    @ToolParam(required = false, description = "是否需要查询axis3轴3电流反馈值")
    private Boolean needAxis3Afb = false;
    
    @ToolParam(required = false, description = "是否需要查询axis3轴3位置指令值")
    private Boolean needAxis3Ecmd = false;
    
    @ToolParam(required = false, description = "是否需要查询axis3轴3位置反馈值")
    private Boolean needAxis3Efb = false;

    /**
     * axis4相关电压、电流、位置参数
     */
    @ToolParam(required = false, description = "是否需要查询axis4轴4电压指令值")
    private Boolean needAxis4Vcmd = false;
    
    @ToolParam(required = false, description = "是否需要查询axis4轴4电压反馈值")
    private Boolean needAxis4Vfb = false;
    
    @ToolParam(required = false, description = "是否需要查询axis4轴4电流指令值")
    private Boolean needAxis4Acmd = false;
    
    @ToolParam(required = false, description = "是否需要查询axis4轴4电流反馈值")
    private Boolean needAxis4Afb = false;
    
    @ToolParam(required = false, description = "是否需要查询axis4轴4位置指令值")
    private Boolean needAxis4Ecmd = false;

    @ToolParam(required = false, description = "是否需要查询axis4轴4位置反馈值")
    private Boolean needAxis4Efb = false;

    /**
     * axis5相关电压、电流、位置参数
     */
    @ToolParam(required = false, description = "是否需要查询axis5轴5电压指令值")
    private Boolean needAxis5Vcmd = false;
    
    @ToolParam(required = false, description = "是否需要查询axis5轴5电压反馈值")
    private Boolean needAxis5Vfb = false;
    
    @ToolParam(required = false, description = "是否需要查询axis5轴5电流指令值")
    private Boolean needAxis5Acmd = false;
    
    @ToolParam(required = false, description = "是否需要查询axis5轴5电流反馈值")
    private Boolean needAxis5Afb = false;
    
    @ToolParam(required = false, description = "是否需要查询axis5轴5位置指令值")
    private Boolean needAxis5Ecmd = false;
    
    @ToolParam(required = false, description = "是否需要查询axis5轴5位置反馈值")
    private Boolean needAxis5Efb = false;
    
    // 范围查询参数
    /**
     * axis0范围查询参数
     */
    @ToolParam(required = false, description = "axis0轴0电压指令值最小值")
    private Float axis0VcmdMin;
    
    @ToolParam(required = false, description = "axis0轴0电压指令值最大值")
    private Float axis0VcmdMax;
    
    @ToolParam(required = false, description = "axis0轴0电压反馈值最小值")
    private Float axis0VfbMin;
    
    @ToolParam(required = false, description = "axis0轴0电压反馈值最大值")
    private Float axis0VfbMax;
    
    @ToolParam(required = false, description = "axis0轴0电流指令值最小值")
    private Float axis0AcmdMin;
    
    @ToolParam(required = false, description = "axis0轴0电流指令值最大值")
    private Float axis0AcmdMax;
    
    @ToolParam(required = false, description = "axis0轴0电流反馈值最小值")
    private Float axis0AfbMin;
    
    @ToolParam(required = false, description = "axis0轴0电流反馈值最大值")
    private Float axis0AfbMax;
    
    @ToolParam(required = false, description = "axis0轴0位置指令值最小值")
    private Float axis0EcmdMin;
    
    @ToolParam(required = false, description = "axis0轴0位置指令值最大值")
    private Float axis0EcmdMax;
    
    @ToolParam(required = false, description = "axis0轴0位置反馈值最小值")
    private Float axis0EfbMin;
    
    @ToolParam(required = false, description = "axis0轴0位置反馈值最大值")
    private Float axis0EfbMax;

    /**
     * axis1范围查询参数
     */
    @ToolParam(required = false, description = "axis1轴1电压指令值最小值")
    private Float axis1VcmdMin;
    
    @ToolParam(required = false, description = "axis1轴1电压指令值最大值")
    private Float axis1VcmdMax;
    
    @ToolParam(required = false, description = "axis1轴1电压反馈值最小值")
    private Float axis1VfbMin;
    
    @ToolParam(required = false, description = "axis1轴1电压反馈值最大值")
    private Float axis1VfbMax;
    
    @ToolParam(required = false, description = "axis1轴1电流指令值最小值")
    private Float axis1AcmdMin;
    
    @ToolParam(required = false, description = "axis1轴1电流指令值最大值")
    private Float axis1AcmdMax;
    
    @ToolParam(required = false, description = "axis1轴1电流反馈值最小值")
    private Float axis1AfbMin;
    
    @ToolParam(required = false, description = "axis1轴1电流反馈值最大值")
    private Float axis1AfbMax;
    
    @ToolParam(required = false, description = "axis1轴1位置指令值最小值")
    private Float axis1EcmdMin;
    
    @ToolParam(required = false, description = "axis1轴1位置指令值最大值")
    private Float axis1EcmdMax;
    
    @ToolParam(required = false, description = "axis1轴1位置反馈值最小值")
    private Float axis1EfbMin;
    
    @ToolParam(required = false, description = "axis1轴1位置反馈值最大值")
    private Float axis1EfbMax;

    /**
     * axis2范围查询参数
     */
    @ToolParam(required = false, description = "axis2轴2电压指令值最小值")
    private Float axis2VcmdMin;
    
    @ToolParam(required = false, description = "axis2轴2电压指令值最大值")
    private Float axis2VcmdMax;
    
    @ToolParam(required = false, description = "axis2轴2电压反馈值最小值")
    private Float axis2VfbMin;
    
    @ToolParam(required = false, description = "axis2轴2电压反馈值最大值")
    private Float axis2VfbMax;
    
    @ToolParam(required = false, description = "axis2轴2电流指令值最小值")
    private Float axis2AcmdMin;
    
    @ToolParam(required = false, description = "axis2轴2电流指令值最大值")
    private Float axis2AcmdMax;
    
    @ToolParam(required = false, description = "axis2轴2电流反馈值最小值")
    private Float axis2AfbMin;
    
    @ToolParam(required = false, description = "axis2轴2电流反馈值最大值")
    private Float axis2AfbMax;
    
    @ToolParam(required = false, description = "axis2轴2位置指令值最小值")
    private Float axis2EcmdMin;
    
    @ToolParam(required = false, description = "axis2轴2位置指令值最大值")
    private Float axis2EcmdMax;
    
    @ToolParam(required = false, description = "axis2轴2位置反馈值最小值")
    private Float axis2EfbMin;
    
    @ToolParam(required = false, description = "axis2轴2位置反馈值最大值")
    private Float axis2EfbMax;

    /**
     * axis3范围查询参数
     */
    @ToolParam(required = false, description = "axis3轴3电压指令值最小值")
    private Float axis3VcmdMin;
    
    @ToolParam(required = false, description = "axis3轴3电压指令值最大值")
    private Float axis3VcmdMax;
    
    @ToolParam(required = false, description = "axis3轴3电压反馈值最小值")
    private Float axis3VfbMin;
    
    @ToolParam(required = false, description = "axis3轴3电压反馈值最大值")
    private Float axis3VfbMax;
    
    @ToolParam(required = false, description = "axis3轴3电流指令值最小值")
    private Float axis3AcmdMin;
    
    @ToolParam(required = false, description = "axis3轴3电流指令值最大值")
    private Float axis3AcmdMax;
    
    @ToolParam(required = false, description = "axis3轴3电流反馈值最小值")
    private Float axis3AfbMin;
    
    @ToolParam(required = false, description = "axis3轴3电流反馈值最大值")
    private Float axis3AfbMax;
    
    @ToolParam(required = false, description = "axis3轴3位置指令值最小值")
    private Float axis3EcmdMin;
    
    @ToolParam(required = false, description = "axis3轴3位置指令值最大值")
    private Float axis3EcmdMax;
    
    @ToolParam(required = false, description = "axis3轴3位置反馈值最小值")
    private Float axis3EfbMin;
    
    @ToolParam(required = false, description = "axis3轴3位置反馈值最大值")
    private Float axis3EfbMax;

    /**
     * axis4范围查询参数
     */
    @ToolParam(required = false, description = "axis4轴4电压指令值最小值")
    private Float axis4VcmdMin;
    
    @ToolParam(required = false, description = "axis4轴4电压指令值最大值")
    private Float axis4VcmdMax;
    
    @ToolParam(required = false, description = "axis4轴4电压反馈值最小值")
    private Float axis4VfbMin;
    
    @ToolParam(required = false, description = "axis4轴4电压反馈值最大值")
    private Float axis4VfbMax;
    
    @ToolParam(required = false, description = "axis4轴4电流指令值最小值")
    private Float axis4AcmdMin;
    
    @ToolParam(required = false, description = "axis4轴4电流指令值最大值")
    private Float axis4AcmdMax;
    
    @ToolParam(required = false, description = "axis4轴4电流反馈值最小值")
    private Float axis4AfbMin;
    
    @ToolParam(required = false, description = "axis4轴4电流反馈值最大值")
    private Float axis4AfbMax;
    
    @ToolParam(required = false, description = "axis4轴4位置指令值最小值")
    private Float axis4EcmdMin;
    
    @ToolParam(required = false, description = "axis4轴4位置指令值最大值")
    private Float axis4EcmdMax;
    
    @ToolParam(required = false, description = "axis4轴4位置反馈值最小值")
    private Float axis4EfbMin;
    
    @ToolParam(required = false, description = "axis4轴4位置反馈值最大值")
    private Float axis4EfbMax;

    /**
     * axis5范围查询参数
     */
    @ToolParam(required = false, description = "axis5轴5电压指令值最小值")
    private Float axis5VcmdMin;
    
    @ToolParam(required = false, description = "axis5轴5电压指令值最大值")
    private Float axis5VcmdMax;
    
    @ToolParam(required = false, description = "axis5轴5电压反馈值最小值")
    private Float axis5VfbMin;
    
    @ToolParam(required = false, description = "axis5轴5电压反馈值最大值")
    private Float axis5VfbMax;
    
    @ToolParam(required = false, description = "axis5轴5电流指令值最小值")
    private Float axis5AcmdMin;
    
    @ToolParam(required = false, description = "axis5轴5电流指令值最大值")
    private Float axis5AcmdMax;
    
    @ToolParam(required = false, description = "axis5轴5电流反馈值最小值")
    private Float axis5AfbMin;
    
    @ToolParam(required = false, description = "axis5轴5电流反馈值最大值")
    private Float axis5AfbMax;
    
    @ToolParam(required = false, description = "axis5轴5位置指令值最小值")
    private Float axis5EcmdMin;
    
    @ToolParam(required = false, description = "axis5轴5位置指令值最大值")
    private Float axis5EcmdMax;
    
    @ToolParam(required = false, description = "axis5轴5位置反馈值最小值")
    private Float axis5EfbMin;
    
    @ToolParam(required = false, description = "axis5轴5位置反馈值最大值")
    private Float axis5EfbMax;

    /**
     * 最大返回记录数，默认200条
     */
    @ToolParam(required = false, description = "最大返回记录数，字段名为maxResults，默认100条")
    private Integer maxResults = 100;

    /**
     * 排序方式
     */
    @ToolParam(required = false, description = "排序方式")
    private List<Sort> sorts;

    /**
     * 排序内部类
     */
    @Data
    public static class Sort {
        @ToolParam(required = false, description = "排序字段，如recordTime（记录时间）")
        private String field;
        @ToolParam(required = false, description = "是否是升序：true/false")
        private Boolean asc;
    }
}